-- https://www.wowace.com/projects/ace3/pages/ace-gui-3-0-widgets#title-1-1

local AceGUI = LibStub('AceGUI-3.0')

local frame = AceGUI:Create("Frame") -- 创建框架
frame:SetTitle("泰罗卡站塔 设置") -- 设置框架标题
frame:SetStatusText("位面插件") -- 设置框架状态栏文字
frame:SetCallback("OnClose", function(widget) AceGUI:Release(widget) end) --设置调用
frame:SetLayout("Flow") -- 设置布局
frame:SetWidth(500)
frame:SetHeight(600)
frame.frame:SetMinResize(300, 250)
-- frame:Hide()

-- 创建 多选框
function createCheckBox(value, gui, width)
    local CheckBox = AceGUI:Create("CheckBox")
    CheckBox:SetLabel(value)
    CheckBox:SetWidth(width)
    CheckBox:SetCallback("OnValueChanged", function(widget, event, value)
        print( value )
    end)
    gui:AddChild(CheckBox)
end


-- SimpleGroup  ColorPicker Dropdown EditBox Heading Icon Label MultiLineEditBox Slider

local line = AceGUI:Create("InlineGroup")
line:SetLayout("Flow")
line:SetTitle('时间设置')
line.width = "fill"
line.heihght = "fill"
frame:AddChild(line)

local minNotice = {
    3,5,8,10,15,20,25,30
}
-- table.sort(minNotice)
for key,value in pairs(minNotice) do
    createCheckBox(value.."分钟", line, 85)
end


-- 组2
local line1 = AceGUI:Create("InlineGroup")
line1:SetLayout("Flow")
line1:SetTitle('频道设置')
line1.width = "fill"
frame:AddChild(line1)
local channel= {
    "公会频道","团队频道","队伍频道","私密自己",
}
-- table.sort(minNotice)
for key,value in pairs(channel) do
    createCheckBox(value, line1, 110)
end


-- 组3
local line2 = AceGUI:Create("InlineGroup")
line2:SetLayout("Flow")
line2:SetTitle('界面设置')
line2.width = "fill"
frame:AddChild(line2)

-- 滑动条
local Slider = AceGUI:Create("Slider")
Slider:SetLabel("宽度")
Slider:SetSliderValues(100, 200, 10)
Slider:SetFullWidth(true)
Slider:SetCallback("OnValueChanged", function(widget, event, value)
    print( value )
    -- :GetValue()
end)
line2:AddChild(Slider)


-- 文本框
local multiEditbox = AceGUI:Create("MultiLineEditBox")
multiEditbox:SetLabel("备注")
-- multiEditbox:SetText("备注")
multiEditbox:HighlightText(0)
-- multiEditbox:DisableButton(true)
multiEditbox:SetFocus(true)
multiEditbox:SetFullWidth(true)
-- multiEditbox:SetFullHeight(true)
multiEditbox:SetCallback("OnEnterPressed", function(self, event, value)
    print( value )
    -- :GetValue()
end)
frame:AddChild(multiEditbox)


-- 颜色
local ColorPicker = AceGUI:Create("ColorPicker")
ColorPicker:SetLabel("颜色")
ColorPicker:SetColor(255,255,255,1)
ColorPicker:SetCallback("OnValueConfirmed", function(self, event, r, g, b, a)
    print( r, g, b, a )
end)
frame:AddChild(ColorPicker)

-- DropdownGroup
-- local dropdown = AceGUI:Create("DropdownGroup");
-- dropdown:SetLayout("fill");
-- dropdown.width = "fill";
-- dropdown:SetHeight(390);
-- frame:SetLayout("fill");
-- frame:AddChild(dropdown);
-- dropdown.list = {
--     "a", "b"
-- };
-- dropdown:SetGroupList(dropdown.list);


-- ScrollFrame
local scroll = AceGUI:Create("ScrollFrame")
scroll:SetLayout("Flow") -- probably?
frame:AddChild(scroll)


local dropdown = AceGUI:Create("Dropdown")
dropdown:SetList(channel)
dropdown:SetLabel("下拉框")
dropdown:SetCallback("OnValueChanged", function(self, callback, v)
   print(v)
end);
frame:AddChild(dropdown)


-- TabGroup
-- local tabsWidget = AceGUI:Create("TabGroup")

-- tabsWidget:SetTabs({
--     { value = "region", text = 'L["Display"]'},
--     { value = "trigger", text = 'L["Trigger"]'},
-- })
-- tabsWidget:SelectTab(region)
-- tabsWidget:SetLayout("Fill")
-- frame:AddChild(tabsWidget)